import java.util.Scanner;

public class Main {

    //异或和之和
    //给定一个整数数组，求每一个字段的异或和之和
    //方法一：
    //通过双重循环，利用前缀和求出

    public static final int N = 100010;//最大数据范围
    public static int n;//数组长度
    public static int[] a = new int[N];//原始数组
    public static int[] sum = new int[N];//异或前缀和数组

    // 高效解法实现
    static long getAnsFast() {
        long res = 0;
        for (int bit = 0; bit <= 20; bit++) {  // 处理每一位
            int cnt0 = 1, cnt1 = 0;            // 前缀异或统计
            int prefixXor = 0;

            for (int j = 1; j <= n; j++) {
                int currentBit = (a[j] >> bit) & 1;
                prefixXor ^= currentBit;

                if (prefixXor != 0) {
                    res += (long)cnt0 * (1L << bit);
                    cnt1++;
                } else {
                    res += (long)cnt1 * (1L << bit);
                    cnt0++;
                }
            }
        }
        return res;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        for(int i = 1; i <= n; i++){
            a[i] = scan.nextInt();
            sum[i] = sum[i - 1] ^ a[i];
        }
//        System.out.println(getSum());
        System.out.println(getSum2());
    }

    private static long getSum2() {
        long ret = 0;
        for (int i = 1; i <= n; i++) {
            int tmp = 0;
            for (int j = i; j <= n ; j++) {
                tmp ^= a[j];
                ret += tmp;
            }
        }
        return ret;
    }

    private static long getSum() {
        long ret = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = i; j <= n; j++) {
                ret += sum[j] ^ sum[i - 1];
            }
        }
        return ret;
    }

}
